package packets.c2spackets;

import datatypes.MCItemSlot;
import network.MCConnection;
import exceptions.UnrecoverableException;
import packets.PacketHandler;
import world.WorldState;

/**
 * Creative Inventory Action.
 * Setting an item in the players creative inventory.
 * @author remco_lw
 *
 */
public class P0x6B extends PacketHandler {

	public P0x6B(WorldState worldstate) {
		super(worldstate);
	}

	@Override
	public void handle(MCConnection conn) throws UnrecoverableException {
		short slot = conn.r.readShort();
		MCItemSlot slotcontent = MCItemSlot.readFromSocket(conn.r);
		
		if(slot >= 36) {
			slot -= 36;
			conn.getPlayer().setSlotItem(slot, slotcontent);
		} else {
			//TODO
		}
	}

}
